package subject_set.offer100;

/**
 * @author haomin
 * @date 2022/10/22 19:01
 **/
public class Offer56 {
    class Solution {
        public int[] singleNumbers(int[] nums) {
            int[] res = new int[2];
            int ret = 0;
            for(int i : nums) ret ^= i;
            int target = 1;
            while((target & ret) == 0) target <<= 1;
            for(int i : nums){
                if((target & i) == 0) res[0] ^= i;
                else res[1] ^= i;
            }
            return res;
        }
    }
}